package com.wj.blog.controller;

import com.wj.blog.pojo.Log;
import com.wj.blog.service.LogService;
import com.wj.blog.utils.Page;
import com.wj.blog.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

/**
 * Author:   wj
 * Date:     2020/4/16 16:14
 * Description: 日志接口
 */
@RestController
@RequestMapping("/log")
public class LogController {
    @Autowired
    LogService logService;

    /**
     * 分页查询
     * @param page
     * @return
     */
    @PostMapping("/getByPage")
    public Result<Page<Log>> getByPage(@RequestBody Page<Log> page){
       Page<Log> loglist = logService.getByPage(page);
       return new Result<>(loglist);
    }

    /**
     * 批量删除
     * @param ids
     * @return
     */
    @PostMapping("/delete")
    public Result<Object> delete(@RequestBody List<Integer> ids){
        logService.delete(ids);
         return new Result<>("删除成功");
    }
}
